from fastapi import FastAPI
from core.db import init_db
from api import user
from middlewares.request_timer import RequestTimerMiddleware

app = FastAPI(title="FastAPI CRUD 示例")

# 添加中间件
app.add_middleware(RequestTimerMiddleware)

# 处理路由
app.include_router(user.router)

# 初始化 ORM
init_db(app)


@app.get("/")
async def root():
    return {"message": "Hello World"}
#
#
# @app.get("/hello/{name}")
# async def say_hello(name: str):
#     return {"message": f"Hello {name}"}
